//
//  VideoPlayerMask.m
//  Comic
//
//  Created by Ryan on 16/3/12.
//  Copyright © 2016年 程锦. All rights reserved.
//

#import "VideoPlayerMask.h"


@interface VideoPlayerMask ()

@end


@implementation VideoPlayerMask

+ (instancetype)setupPlayerMaskView{
    
    
    static VideoPlayerMask *mask = nil;
    
    static dispatch_once_t onceToken;
    
    dispatch_once(&onceToken, ^{
        
        mask = [[VideoPlayerMask alloc]init];
        
    });
    
    
    
    return mask;

}

- (void)initWithVideoPlayerMask{

    self.backView = [UIView new];
    
    self.backView.backgroundColor = [UIColor colorWithWhite:0.1 alpha:0.6];
    
    [self addSubview:self.backView];
    
    
    
    self.startButton = [UIButton buttonWithType:UIButtonTypeCustom];
    
    [self.backView addSubview:self.startButton];
    
    [self.startButton setImage:[UIImage imageNamed:@"player_pause"] forState:UIControlStateNormal];
    

    
    self.currentTimeLabel = [UILabel new];
    
    self.currentTimeLabel.textColor = [UIColor whiteColor];
    
    self.currentTimeLabel.font = [UIFont systemFontOfSize:12];
    
    
    [self.backView addSubview:self.currentTimeLabel];
    
    
    self.totalTimeLabel = [UILabel new];
    
    self.totalTimeLabel.textColor = [UIColor grayColor];
    
    self.totalTimeLabel.font = [UIFont systemFontOfSize:12];
    
    
    
    
    [self.backView addSubview:self.totalTimeLabel];
    
    
    
    
    self.videoSlider = [UISlider new];
    
    [self.videoSlider setThumbImage:[UIImage imageNamed:@"slider"] forState:UIControlStateNormal];
    
    
    [self.backView addSubview:self.videoSlider];

    
    [self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        
        make.left.right.bottom.mas_equalTo(0);
        
        make.height.mas_equalTo(40);
        
        
    }];
    
    
    [self.startButton mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(5);
        
        make.bottom.mas_equalTo(-5);
        
        make.width.height.mas_equalTo(30);
        
        
    }];
    
    [self.currentTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.startButton.mas_right).offset(10);
        
        make.bottom.mas_equalTo(-10);
        
        make.width.mas_equalTo(50);
        
        make.height.mas_equalTo(20);
        
        
    }];
    
    [self.totalTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        
        make.left.mas_equalTo(self.currentTimeLabel.mas_right).offset(10);
        
        make.bottom.mas_equalTo(-10);
        
        make.width.mas_equalTo(50);
        
        make.height.mas_equalTo(20);
        
    }];
    
    
    
    [self.videoSlider mas_makeConstraints:^(MASConstraintMaker *make) {
        
        
        make.left.right.mas_equalTo(0);
        make.top.mas_equalTo(-5);
        
    }];
    
    


}





@end
